﻿
@{
    ViewBag.Title = "开始盘点";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
    .dv-navigation {
        height: 40px;
        margin-bottom: 5px;
    }

    .progress_bar {
        margin-left: 10px;
        padding: 10px 0 10px;
    }

        .progress_bar li {
            width: 180px;
            float: left;
            text-align: center;
            position: relative;
            line-height: 30px;
            list-style: none;
            border-top: 6px solid #f5f5f5;
        }

            .progress_bar li i {
                position: absolute;
                left: 50%;
                margin-left: -10px;
                top: -14px;
                height: 18px;
                width: 18px;
                border: 2px solid white;
                border-radius: 10px;
                background-color: #f5f5f5;
            }

        .progress_bar .completeLi {
            color: #ff9813;
            border-top-color: #ff9813;
        }

        .progress_bar .completePoint {
            background-color: #ff9813;
        }

    input[name=deptSjsl] {
        padding: 2px;
    }

    input[name=minSjsl] {
        padding: 2px;
    }
</style>
<form id="form1">
    <div class="panel panel-default dv-navigation">
        <ol class="progress_bar">
            <li id="dv_startPd"><i></i><label>开始盘点</label></li>
            <li id="dv_savePd"><i></i><label>保存</label></li>
            <li id="dv_endPd"><i></i><label>结束盘点</label></li>
            <li id="dv_completePd"><i></i><label>完成</label></li>
        </ol>
    </div>
    <div class="panel panel-default" style="margin-bottom:5px;">
        <div class="panel-heading">查询条件</div>
        <table class="form">
            <tr>
                <th class="formTitle" style="width: 50px;">日期：</th>
                <td class="formValue" colspan="2">
                    <select id="ddlRQ" class="form-control"></select>
                </td>
                <th class="formTitle" style="width: 65px;">关键字：</th>
                <td class="formValue" style="width: 115px;">
                    <input id="txtSRM" type="text" class="form-control" placeholder="拼音 药品名称" />
                </td>
                <th class="formTitle">药品状态：</th>
                <td class="formValue" style="width: 55px;">
                    <select id="ddlYPZT" name="ddlYPZT" class="form-control">
                        <option value="-1">全部</option>
                        <option value="1">启用</option>
                        <option value="0">停用</option>
                    </select>
                </td>
                <th class="formTitle" style="display:none">药品类别：</th>
                <td class="formValue" style="display:none">
                    <select id="ddlYPLB" class="form-control">
                        <option value="">全部</option>
                    </select>
                </td>
                <th class="formTitle">库存显示：</th>
                <td class="formValue">
                    <select id="ddlKCXS" name="ddlKCXS" class="form-control">
                        <option value="-1">全部</option>
                        <option value="0">显示零库存</option>
                        <option value="1">不显示理论数量为零</option>
                        <option value="2">不显示实际数量为零</option>
                        <option value="4">不显示两者都为零</option>
                    </select>
                </td>
                <td class="formValue" style="width: 160px;">
                    <input type="button" id="btn_search" class="btn btn-primary" value="查询" />
                    <input type="button" id="btn_backIndex" class="btn btn-primary" value="返回首页" style="float:right;" />
                </td>
            </tr>
        </table>
    </div>
    <div class="panel panel-default" style="margin-bottom: 0;">
        <div class="panel-heading">
            <span>盘点明细 | 单位选择：  部门单位</span>
            <i id='i-changeUnit' onclick='ChooseUnit(this)' class='fa fa-toggle-off' style='margin:0 5px;font-size:1.6rem;color:#ff9813;vertical-align:middle;'></i>最小单位
        </div>
    </div>
    <div id="dv-pdmx-deptUnit">
        <table id="gridKCInfo"></table>
        <div id="gridPager" rel="form1"></div>
    </div>
    <div id="dv-pdmx-minUnit" style="display: none;">
        <table id="gridKCInfoByMinUnit"></table>
        <div id="gridKCInfoByMinUnitPager" rel="form1"></div>
    </div>
    <div style="color: #ff0000;float: left;margin-top: 10px;">(实)部门数：实际部门单位数；(实)最小数：实际最小单位数！</div>
    @Html.Partial("_BottomButtonsView", new Newtouch.HIS.Web.Core.Models.BottomButtonViewModel
{
    ShowKeyList = new[] { 8,  7, 3,9 },
    F3Text = "结束",
    F7Text = "重新盘点",
    F9Text = "盘点打印"
})
    <div class="ckbox" style="float: right;margin-top: 10px;">
        <input id="autoCarryDown" name="autoCarryDown" type="checkbox" checked="checked">
        <label for="autoCarryDown"></label>
    </div>
    <div style="float:right;margin: 10px 5px 0 0;font-size: 14px;">自动结转：</div>
</form>
<script language="javascript">
    var $gridKCInfo = $("#gridKCInfo");
    var $gridKCInfoMinUnit = $("#gridKCInfoByMinUnit");
    var lastRowId;
    var ObjArr_Load = new Array();
    $(".toolbar").css("width", 350);

    $(function () {
        $("#btn_backIndex").click(function () {//返回
            $.loading("页面跳转中");
            window.location.href = "StockInventoryV2";
        });
        StartInventory();
        InitialPd();
    });

    //初始化盘点
    function InitialPd() {
        gridKCInfo();
        gridKCInfoMinUnit();
        $("#btn_search").click(function () {//绑定查询查询
            if ($("#i-changeUnit").hasClass("fa-toggle-off")) {
                $gridKCInfo.jqGrid('setGridParam',
                    {
                        url: "/PharmacyDrugStorage/InventoryInfoQuery?r=" + Math.random(),
                        postData: getSearchPostData()
                    }).trigger('reloadGrid');
            } else {
                $gridKCInfoMinUnit.jqGrid('setGridParam',
                    {
                        url: "/PharmacyDrugStorage/InventoryInfoQuery?r=" + Math.random(),
                        postData: getSearchPostData()
                    }).trigger('reloadGrid');
            }
        });
    }

    //开始盘点
    function StartInventory() {
        $.najax({
            type: "POST",
            url: "/PharmacyDrugStorage/StartInventory",
            dataType: "json",
            cache: false,
            success: function (ajaxresp) {
                GetPDSJ();//获取盘点日期
                $.UpdateProgressbar.update(1);
            }
        });
    }

    //获取盘点时间
    function GetPDSJ() {
        $.najax({
            type: "GET",
            url: "/PharmacyDrugStorage/GetPDDateDropdownList",
            dataType: "json",
            success: function (ajaxresp) {
                //先清空，再填充
                $("#ddlRQ").empty();
                for (var i = 0; i < ajaxresp.data.length; i++) {
                    $("#ddlRQ").append('<option data-pdId=' + ajaxresp.data[i].pdId + '>' + ajaxresp.data[i].pdsj + '</option>');
                }
                $("#btn_search").trigger("click");
            }
        });
    }

    //库存信息
    function gridKCInfo() {
        $gridKCInfo.dataGrid({
            postData: getSearchPostData(),
            height: $(window).height() - 270,
            url: "",
            editurl: "clientArray",  //行编辑不向服务器提交数据
            colModel: [
                { label: '药品代码', name: 'ypCode', width: 80, align: 'left' },
                { label: '药品名称', name: 'ypmc', width: 120, align: 'left' },
                { label: '规格', name: 'ypgg', width: 80, align: 'left' },
                { label: '理论数', name: 'llsl', width: 80, align: 'left' },
                { label: '(实)部门数', name: 'deptSjsl', width: 70, align: 'center', editable: true, editwidth: "90%" },
                { label: '单位', name: 'deptdw', width: 40, align: 'left' },
                { label: '系数', name: 'zhyz', width: 40, align: 'left' },
                { label: '批号', name: 'ph', width: 100, align: 'center' },
                { label: '批次', name: 'pc', width: 100, align: 'left' },
                { label: '有效期', name: 'yxq', width: 80, align: 'left' },
                { label: '批发价', name: 'pfj', width: 60, align: 'left' },
                { label: '零售价', name: 'lsj', width: 60, align: 'left' },
                { label: '批发金额(理)', name: 'llpfje', width: 70, align: 'left' },
                { label: '零售金额(理)', name: 'lllsje', width: 70, align: 'left' },
                { label: '批发金额(实)', name: 'sjpfje', width: 70, align: 'left' },
                { label: '零售金额(实)', name: 'sjlsje', width: 70, align: 'left' },
                { label: '产地', name: 'ycmc', width: 120, align: 'left' },
                { label: '拼音', name: 'py', width: 100, align: 'left' },
                { label: 'pdmxId', name: 'pdmxId', hidden: true },
                { label: '理论数', name: 'llsl_zxbz', hidden: true },
                { label: '实际数量(部门包装)', name: 'sjslstr', hidden: true },
                { label: 'CreateTime', name: 'CreateTime', hidden: true }
            ],
            multiselect: false,
            pager: "#gridPager",
            sortname: 'ypmc asc',
            sortable: true,
            viewrecords: true,
            onPaging: function () {
                savePdsPage();
            },
            gridComplete: function () {
                afterCompleteFunction();
                window.initLayout("MyTabGrid");
            },
            onSelectRow: function (rowid) {
                $("#" + $.jgrid.jqID(rowid) + "_deptSjsl").focus();
            }
        });
    }

    //库存信息
    function gridKCInfoMinUnit() {
        $gridKCInfoMinUnit.dataGrid({
            postData: getSearchPostData(),
            height: $(window).height() - 270,
            url: "",
            editurl: "clientArray",  //行编辑不向服务器提交数据
            colModel: [
                { label: '药品代码', name: 'ypCode', width: 80, align: 'left' },
                { label: '药品名称', name: 'ypmc', width: 120, align: 'left' },
                { label: '规格', name: 'ypgg', width: 80, align: 'left' },
                { label: '理论数', name: 'llsl', width: 80, align: 'left' },
                { label: '(实)最小数', name: 'minSjsl', width: 70, align: 'center', editable: true, editwidth: "90%" },
                { label: '单位', name: 'zxdw', width: 40, align: 'left' },
                { label: '系数', name: 'zhyz', width: 40, align: 'left' },
                { label: '批号', name: 'ph', width: 100, align: 'center' },
                { label: '批次', name: 'pc', width: 100, align: 'left' },
                { label: '有效期', name: 'yxq', width: 80, align: 'left' },
                { label: '批发价', name: 'pfj', width: 60, align: 'left' },
                { label: '零售价', name: 'lsj', width: 60, align: 'left' },
                { label: '批发金额(理)', name: 'llpfje', width: 70, align: 'left' },
                { label: '零售金额(理)', name: 'lllsje', width: 70, align: 'left' },
                { label: '批发金额(实)', name: 'sjpfje', width: 70, align: 'left' },
                { label: '零售金额(实)', name: 'sjlsje', width: 70, align: 'left' },
                { label: '产地', name: 'ycmc', width: 120, align: 'left' },
                { label: '拼音', name: 'py', width: 100, align: 'left' },
                { label: 'pdmxId', name: 'pdmxId', hidden: true },
                { label: '理论数', name: 'llsl_zxbz', hidden: true },
                { label: '实际数量(部门包装)', name: 'sjslstr', hidden: true },
                { label: 'CreateTime', name: 'CreateTime', hidden: true }
            ],
            multiselect: false,
            pager: "#gridKCInfoByMinUnitPager",
            sortname: 'ypmc asc',
            sortable: true,
            viewrecords: true,
            onPaging: function () {
                savePdsPage();
            },
            gridComplete: function () {
                afterCompleteFunctionMinUnit();
                window.initLayout("MyTabGrid");
            },
            onSelectRow: function (rowid) {
                $("#" + $.jgrid.jqID(rowid) + "_minSjsl").focus();
            }
        });
    }

    //选择单位
    function ChooseUnit(obj) {
        if ($(obj).hasClass("fa-toggle-off")) {
            $(obj).removeClass("fa-toggle-off");
            $(obj).addClass("fa-toggle-on");
            $("#dv-pdmx-deptUnit").hide();
            $("#dv-pdmx-minUnit").show();
        } else {
            $(obj).removeClass("fa-toggle-on");
            $(obj).addClass("fa-toggle-off");
            $("#dv-pdmx-deptUnit").show();
            $("#dv-pdmx-minUnit").hide();
        }
        $("#btn_search").trigger("click");
    }

    //查询条件
    function getSearchPostData() {
        var pdsj = $("#ddlRQ").val();
        var pdId = $("#ddlRQ option:selected").attr('data-pdId');
        var srm = $("#txtSRM").val();
        var ypzt = $("#ddlYPZT").val();
        var kcxs = $("#ddlKCXS").val();
        if (!pdsj && !pdId) {
            return false;
        }
        if (kcxs === "" || kcxs == null) {
            kcxs = -1;
        }
        return { pdsj: pdsj, pdId: pdId, srm: srm, ypzt: ypzt, yplb: "", kcxs: kcxs };
    };

    //加载第一次查询数据
    function afterCompleteFunction() {
        ObjArr_Load = [];
        $.loading("数据加载中");
        var rowIds = $gridKCInfo.jqGrid('getDataIDs');//Grid加载完成开启行内编辑   1.先获取所有行Id  2.遍历调用editRow方法
        for (var i = 0; i < rowIds.length; i++) {
            ObjArr_Load.push($gridKCInfo.jqGrid('getRowData', rowIds[i]));
            $gridKCInfo.jqGrid('editRow', rowIds[i], true, null, null, null, null, function (callbackRowId) {     //true: when set to true we can use [Enter] key to save the row and [Esc] to cancel editing.
            });
        }
        $.loading(false);
    }

    //加载第一次查询数据
    function afterCompleteFunctionMinUnit() {
        ObjArr_Load = [];
        $.loading("数据加载中");
        var rowIds = $gridKCInfoMinUnit.jqGrid('getDataIDs');//Grid加载完成开启行内编辑   1.先获取所有行Id  2.遍历调用editRow方法
        for (var i = 0; i < rowIds.length; i++) {
            ObjArr_Load.push($gridKCInfoMinUnit.jqGrid('getRowData', rowIds[i]));
            $gridKCInfoMinUnit.jqGrid('editRow', rowIds[i], true, null, null, null, null, function (callbackRowId) {     //true: when set to true we can use [Enter] key to save the row and [Esc] to cancel editing.
            });
        }
        $.loading(false);
    }

    function savePdsPage() {
        var $targetJqg;
        if ($("#i-changeUnit").hasClass("fa-toggle-off")) {
            $targetJqg = $gridKCInfo;//获取所有行Id，遍历使编辑框处于保存状态
        } else {
            $targetJqg = $gridKCInfoMinUnit;//获取所有行Id，遍历使编辑框处于保存状态
        }
        var rowIds = $targetJqg.jqGrid('getDataIDs');//获取所有行Id，遍历使编辑框处于保存状态

        //判断退数量
        for (var i = 0; i < rowIds.length; i++) {
            $targetJqg.saveRow(rowIds[i], null, null, null, function (callbackRowId) { }, null, null);
            var rowData = $targetJqg.jqGrid('getRowData', rowIds[i]);
            if (!rowData) {
                return false;
            }
            if ($("#i-changeUnit").hasClass("fa-toggle-off")) { //部门单位
                if (rowData.deptSjsl.replace(/(^\s*)|(\s*$)/g, "") === "" || rowData.deptSjsl < 0 || isNaN(rowData.deptSjsl) || rowData.deptSjsl === "") {
                    $.modalAlert("项目（" + rowData.ypmc + "）实际数量应为自然数，请确认。", "warning");
                    EnableInlineEditBox();//启用行内编辑框
                    return false;
                }
            } else { //最小单位
                if (rowData.minSjsl.replace(/(^\s*)|(\s*$)/g, "") === "" || rowData.minSjsl < 0 || isNaN(rowData.minSjsl) || rowData.minSjsl === "") {
                    $.modalAlert("项目（" + rowData.ypmc + "）实际数量应为自然数，请确认。", "warning");
                    EnableInlineEditBoxMinUnit();//启用行内编辑框
                    return false;
                }
            }
        }
        var kcInfoJsonSave = $targetJqg.jqGrid('getRowData_AllLine');
        var objArrSave = new Array();
        $.each(kcInfoJsonSave, function () {//保存时将Grid的数据行放在新的数组中
            objArrSave.push(this);
        });
        var resultObjArr = new Array();
        //与页面加载的数组进行比对，将修改过的数据行放在resultObjArr中，传给后台
        for (var i = 0; i < objArrSave.length; i++) {
            if (objArrSave[i].deptSjsl !== ObjArr_Load[i].deptSjsl || objArrSave[i].minSjsl !== ObjArr_Load[i].minSjsl) {
                resultObjArr.push({ pdmxId: objArrSave[i].pdmxId, sjsl: CalculationMinUnitNum(objArrSave[i].deptSjsl, objArrSave[i].minSjsl, objArrSave[i].zhyz) });
            }
        }
        if (resultObjArr.length === 0) {
        }
        else {
            $.najax({
                type: "POST",
                url: "/PharmacyDrugStorage/SaveInventoryInfo",
                dataType: "json",
                data: { resultObjArr: JSON.stringify(resultObjArr), pdId: $("#ddlRQ option:selected").attr('data-pdId') },
                success: function (ajaxresp) {
                    //$("#btn_search").trigger("click");
                    $.UpdateProgressbar.update(2);
                    //$.modalAlert("保存成功", 'success');
                },
                error: function (ajaxresp) {
                    $.modalAlert(ajaxresp.message, Error);
                }
            });
        }
    };

    //保存
    function newtouch_event_f8() {
        var $targetJqg;
        if ($("#i-changeUnit").hasClass("fa-toggle-off")) {
            $targetJqg = $gridKCInfo;//获取所有行Id，遍历使编辑框处于保存状态
        } else {
            $targetJqg = $gridKCInfoMinUnit;//获取所有行Id，遍历使编辑框处于保存状态
        }
        var rowIds = $targetJqg.jqGrid('getDataIDs');//获取所有行Id，遍历使编辑框处于保存状态

        //判断退数量
        for (var i = 0; i < rowIds.length; i++) {
            $targetJqg.saveRow(rowIds[i], null, null, null, function (callbackRowId) { }, null, null);
            var rowData = $targetJqg.jqGrid('getRowData', rowIds[i]);
            if (!rowData) {
                return false;
            }
            if ($("#i-changeUnit").hasClass("fa-toggle-off")) { //部门单位
                if (rowData.deptSjsl.replace(/(^\s*)|(\s*$)/g, "") === "" || rowData.deptSjsl < 0 || isNaN(rowData.deptSjsl) || rowData.deptSjsl === "") {
                    $.modalAlert("项目（" + rowData.ypmc + "）实际数量应为自然数，请确认。", "warning");
                    EnableInlineEditBox();//启用行内编辑框
                    return false;
                }
            } else { //最小单位
                if (rowData.minSjsl.replace(/(^\s*)|(\s*$)/g, "") === "" || rowData.minSjsl < 0 || isNaN(rowData.minSjsl) || rowData.minSjsl === "") {
                    $.modalAlert("项目（" + rowData.ypmc + "）实际数量应为自然数，请确认。", "warning");
                    EnableInlineEditBoxMinUnit();//启用行内编辑框
                    return false;
                }
            }
        }
        var kcInfoJsonSave = $targetJqg.jqGrid('getRowData_AllLine');
        var objArrSave = new Array();
        $.each(kcInfoJsonSave, function () {//保存时将Grid的数据行放在新的数组中
            objArrSave.push(this);
        });
        var resultObjArr = new Array();
        //与页面加载的数组进行比对，将修改过的数据行放在resultObjArr中，传给后台
        for (var i = 0; i < objArrSave.length; i++) {
            if (objArrSave[i].deptSjsl !== ObjArr_Load[i].deptSjsl || objArrSave[i].minSjsl !== ObjArr_Load[i].minSjsl) {
                resultObjArr.push({ pdmxId: objArrSave[i].pdmxId, sjsl: CalculationMinUnitNum(objArrSave[i].deptSjsl, objArrSave[i].minSjsl, objArrSave[i].zhyz) });
            }
        }
        if (resultObjArr.length === 0) {
            $.modalAlert("没有需要保存的数据", 'warning');
            $("#btn_search").trigger("click");
            $.UpdateProgressbar.update(2);
            return false;
        }
        $.najax({
            type: "POST",
            url: "/PharmacyDrugStorage/SaveInventoryInfo",
            dataType: "json",
            data: { resultObjArr: JSON.stringify(resultObjArr), pdId: $("#ddlRQ option:selected").attr('data-pdId') },
            success: function (ajaxresp) {
                $("#btn_search").trigger("click");
                $.UpdateProgressbar.update(2);
                $.modalAlert("保存成功", 'success');
            },
            error: function (ajaxresp) {
                $.modalAlert(ajaxresp.message, Error);
            }
        });
    };

    //将库存换算成最小单位数  拆零
    function CalculationMinUnitNum(deptNum, minNum, zhyz) {
        if (deptNum == null) return parseInt(minNum);
        if (minNum == null) return parseInt(deptNum) * parseInt(zhyz);
        return parseInt(deptNum) * parseInt(zhyz) + parseInt(minNum);
    }

    //将库存换算成最小单位数  不拆零
    function CalculationMinUnitNumNoOpen(deptNum, zhyz) {
        return parseInt(deptNum) * parseInt(zhyz);
    }

    //启用行内编辑框
    function EnableInlineEditBox() {
        var rowIds = $gridKCInfo.jqGrid('getDataIDs');//Grid加载完成开启行内编辑   1.先获取所有行Id  2.遍历调用editRow方法
        for (var i = 0; i < rowIds.length; i++) {
            $gridKCInfo.jqGrid('editRow', rowIds[i], true, null, null, null, null, function (callbackRowId) {     //true: when set to true we can use [Enter] key to save the row and [Esc] to cancel editing.
            });
        }
    }

    //启用行内编辑框
    function EnableInlineEditBoxMinUnit() {
        var rowIds = $gridKCInfoMinUnit.jqGrid('getDataIDs');//Grid加载完成开启行内编辑   1.先获取所有行Id  2.遍历调用editRow方法
        for (var i = 0; i < rowIds.length; i++) {
            $gridKCInfoMinUnit.jqGrid('editRow', rowIds[i], true, null, null, null, null, function (callbackRowId) {     //true: when set to true we can use [Enter] key to save the row and [Esc] to cancel editing.
            });
        }
    }

    //结束盘点
    function newtouch_event_f3() {
        savePdsPage();

        if ($("#autoCarryDown").is(":checked")) {
            $.modalConfirm("确定自动生成结转？",
                function (flag) {
                    if (flag) {
                        InventorySubmit();
                    }
                });
        } else {
            InventorySubmit();
        }
    }

    //提交
    function InventorySubmit() {
        $.najax({
            type: "POST",
            url: "/PharmacyDrugStorage/EndInventory",
            dataType: "json",
            data: { pdId: $("#ddlRQ option:selected").attr('data-pdId'), autoCarryDown: $("#autoCarryDown").is(":checked") ? "1" : "0" },
            success: function (ajaxresp) {
                $.modalAlert("盘点完成", 'success');
                GetPDSJ();//刷新盘点时间及药品信息
                $.UpdateProgressbar.update(4);
            },
            error: function (ajaxresp) {
                $.modalAlert(ajaxresp.message, Error);
            }
        });
    }

    //取消盘点
    function newtouch_event_f7() {
        $.modalConfirm("确定重新盘点吗？",
            function (flag) {
                if (flag) {
                    var pdId = $("#ddlRQ option:selected").attr('data-pdId');
                    $.najax({
                        type: "POST",
                        url: "/PharmacyDrugStorage/CancelInventory",
                        dataType: "json",
                        data: { pdId: pdId },
                        success: function (ajaxresp) {
                            $("#ddlRQ option[data-pdId='" + pdId + "']").remove();
                            StartInventory();
                        }
                    });
                }
            });
    }

    //盘点明细打印
    function newtouch_event_f9() {
        var srm = $("#txtSRM").val();
        var ypzt = $("#ddlYPZT").val();
        var kcxs = $("#ddlKCXS").val();
        var pdId = $("#ddlRQ option:selected").attr('data-pdId');
        window.open("/Report/PrintReport?type=StockInventoryV2&param=srm=" + srm + "|ypzt=" + ypzt + "|kcxs=" + kcxs + "|pdId=" + pdId + "|yfbm=@ViewBag.bmCode |OrganizeId=@ViewBag.OrganizeId", "height=500, width=1195, top=100, left=50, toolbar=no, menubar=no, scrollbar=yes, resizeble=no, location=no, status=no");
    }

    //进度调更新
    $.UpdateProgressbar = {
        startPd: function () {
            $(".progress_bar").find("li").removeClass("completeLi");
            $(".progress_bar").find("i").removeClass("completePoint");
            if (!$("#dv_startPd").hasClass("completeLi")) {
                $("#dv_startPd").addClass("completeLi");
            }
            if (!$("#dv_startPd").find("i").hasClass("completePoint")) {
                $("#dv_startPd").find("i").addClass("completePoint");
            }
        },
        savePd: function () {
            if (!$("#dv_savePd").hasClass("completeLi")) {
                $("#dv_savePd").addClass("completeLi");
            }
            if (!$("#dv_savePd").find("i").hasClass("completePoint")) {
                $("#dv_savePd").find("i").addClass("completePoint");
            }
        },
        endPd: function () {
            if (!$("#dv_endPd").hasClass("completeLi")) {
                $("#dv_endPd").addClass("completeLi");
            }
            if (!$("#dv_endPd").find("i").hasClass("completePoint")) {
                $("#dv_endPd").find("i").addClass("completePoint");
            }
        },
        completePd: function () {
            if (!$("#dv_completePd").hasClass("completeLi")) {
                $("#dv_completePd").addClass("completeLi");
            }
            if (!$("#dv_completePd").find("i").hasClass("completePoint")) {
                $("#dv_completePd").find("i").addClass("completePoint");
            }
        },
        update: function (step) {
            switch (step) {
                case 1:
                    $.UpdateProgressbar.startPd();
                    break;
                case 2:
                    $.UpdateProgressbar.startPd();
                    $.UpdateProgressbar.savePd();
                    break;
                case 3:
                    $.UpdateProgressbar.startPd();
                    $.UpdateProgressbar.savePd();
                    $.UpdateProgressbar.endPd();
                    break;
                case 4:
                    $.UpdateProgressbar.startPd();
                    $.UpdateProgressbar.savePd();
                    $.UpdateProgressbar.endPd();
                    $.UpdateProgressbar.completePd();
                    break;
            }
        },
        clean: function () {//初始化进度条 归零
            $("li").removeClass("completeLi");
            $("i").removeClass("completePoint");
        }
    };
</script>